{extends file="index.tpl"}
{block name=head_title}HỢP ĐỒNG{/block}
{block name=head_script}{/block}
{block name=head_style}{/block}
{block name=body}
    <br />
    <a href="/hopdong/add" class="link_add_new">Thêm hợp đồng</a>
    <br />
    <br />
    <!-- Table View -->
    <table cellspacing="0" cellpadding="3" align="center" border="1" class="table">
        <thead>
            <tr>
                <th colspan="18" class="table_thead_tr">
                    HỢP ĐỒNG QUÁN CAFE<br />{if $id!=0 }{$diadiem_hopdong[0].TenDD}{/if}
                </th>
            </tr>
            <tr class="table_thead_tr">
                <th rowspan="2" style="width: 145px">Contract Number</th>
                <th rowspan="2" style="width:65px">Rental<br/>Duration (months)</th>
                <th rowspan="2" style="width: 95px">Rental Unit Price (month/LCD)</th>
                <th rowspan="2" style="width: 75px">LCD Quantity (pcs/cafe)</th>
                <th rowspan="2" style="width: 95px">Maintenance (days)</th>
                <th rowspan="2" style="width: 80px">Total Rental Value (cafe/month)</th>
                <th rowspan="2" style="width: 80px">Total Rental Value</th>
                <th colspan="2">Contract Timing<br/>(effective date)</th>
                <th rowspan="2" style="width: 65px">Payment method</th>
                <th rowspan="2" style="width: 55px">Số đợt</th>
                <th rowspan="2" style="width: 55px">Đợt TT</th>
                <th rowspan="2" style="width: 55px">Valid</th>
                <th rowspan="2" style="width: 45px">Notes</th>
                <th rowspan="2" style="width: 45px">Chủ TK</th>
                <th rowspan="2" style="width: 45px">Số TK</th>
                <th rowspan="2" style="width: 45px">Ngân Hàng</th>
                <th rowspan="2" style="width: 45px"></th>
            </tr>
            <tr class="table_thead_tr">
                <th style="width: 90px">Start</th>   
                <th style="width: 90px">End</th>
            </tr>
        </thead>
        <tbody>
            {foreach from=$diadiem_hopdong item=i}
                <tr>
                    <td title="{$i.TenDD}">{$i.MaHD}</td>         
                    <td style="text-align: center">{$i.SoThang}</td>
                    <td style="text-align: right">{$i.Gia|number_format}</td>
                    <td style="text-align: center">{$i.SoLuong}</td>
                    <td style="text-align: center">{$i.SoNgayBaoDuong}</td>
                    <td style="text-align: right">{($i.SoLuong * $i.Gia)|number_format}</td>
                    <td style="text-align: right">{($i.SoLuong * $i.Gia * $i.SoThang)|number_format}</td>
                    <td style="text-align: center">{$i.ThoiGianBatDau|date_format:"%d-%m-%Y"}</td>              
                    <td style="text-align: center">{$i.ThoiGianKetThuc|date_format:"%d-%m-%Y"}</td>
                    <td style="text-align: center">{$i.TenPTTT}</td>
                    <td style="text-align: center">{$i.SoDotThanhToan}</td>
                    <td style="text-align: center">{$i.TenDTT}</td>
                    <td style="text-align: center">{if $i.HieuLuc == 1}Valid{else}Unvalid{/if}</td>
                    <td style="text-align: center">{$i.GhiChu}</td>
                    <td style="text-align: center">{$i.ChuTK}</td>
                    <td style="text-align: center">{$i.SoTK}</td>
                    <td style="text-align: center">{$i.TenNH}</td>
                    <td style="text-align: center"><a href="/hopdong/edit/{$i.ID}">Edit</a></td>
                </tr>
            {/foreach}
        </tbody>
    </table>
{/block}


